﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace FeatureModelTool.Windows
{
    /// <summary>
    /// Interaction logic for NewFeatureModelDialog.xaml
    /// </summary>
    public partial class NewFileDialog : Window
    {
        public bool Dirty { get; protected set; }
        public string FileName { get; protected set; }
        public NewFileDialog()
        {
            InitializeComponent();
        }
        /// <summary>
        /// OkButton Click Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            this.Dirty = true;
            bool addEx = false;

            string[] splits = this.NameTextbox.Text.Split('.');
            string ex = splits[splits.Length - 1];
            if (ex != ".fm")
            {
                addEx = true;
            }

            if (addEx)
            {
                this.FileName = this.NameTextbox.Text + ".fm";
            }
            else
            {
                this.FileName = this.NameTextbox.Text;
            }
            this.Close();
        }
    }
}
